
package com.insigma.business.qrcode.soldier.service.impl;


import com.insigma.business.qrcode.common.service.SequenceGenerator;
import com.insigma.business.qrcode.soldier.dao.VenueInfoDao;
import com.insigma.business.qrcode.soldier.dto.SequenceNameConstant;
import com.insigma.business.qrcode.soldier.entity.VenueInfoDO;
import com.insigma.business.qrcode.soldier.request.VenueInfoBSearcher;
import com.insigma.business.qrcode.soldier.service.VenueInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.ArrayList;
import java.util.List;


@Service("venueInfoService")
public class VenueInfoServiceImpl implements VenueInfoService {

    @Autowired(required = false)
    private VenueInfoDao venueInfoDao;
    @Autowired(required = false)
    private SequenceGenerator sequenceGenerator;

    
    @Override
    public List<VenueInfoDO> search(final VenueInfoBSearcher venueInfoBSearcher) {
        if (venueInfoBSearcher.getVenueIds() != null && venueInfoBSearcher.getVenueIds().size() == 0) {
            venueInfoBSearcher.setTotalCount(0);
            return new ArrayList<>();
        }
        return venueInfoDao.search(venueInfoBSearcher);
    }
   
    @Override
    public VenueInfoDO get(final String id){
        return venueInfoDao.get(id);
    }

    
    @Override
    public Integer insert(final VenueInfoDO venueInfoDO){
        venueInfoDO.setId(sequenceGenerator.genKey(SequenceNameConstant.VENUE_INFO_ID));
        return venueInfoDao.insert(venueInfoDO);
    }

    
    @Override
    public Integer update(final VenueInfoDO venueInfoDO){
        return venueInfoDao.update(venueInfoDO);
    }

    
    @Override
    public Integer delete(final String id, final String modifierType, final String modifierId){
        return venueInfoDao.delete(id,modifierType,modifierId);
    }

    @Override
    public Integer addLike(String id) {
        return venueInfoDao.addLike(id);
    }

    @Override
    public VenueInfoDO getByDeviceId(String deviceId) {
        return venueInfoDao.getByDeviceId(deviceId);
    }

    @Override
    public List<VenueInfoDO> listByOrgId(String id) {
        return venueInfoDao.listByOrgId(id);
    }

}
